package mybatisgen.exec;


import mybatisgen.demo.service.DataBase;
import mybatisgen.demo.service.ExecTemp;
import mybatisgen.demo.service.GeneratorTool;
import org.mybatis.generator.exception.InvalidConfigurationException;
import org.mybatis.generator.exception.XMLParserException;

import java.io.*;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;

public class VelocityTemplateExample {

    public static void main(String[] args) throws XMLParserException, SQLException, IOException, InterruptedException, InvalidConfigurationException {
        List<String> tableNameList = getTable();
        for (String tableName : tableNameList) {
            // 初始化Velocity引擎
            ByteArrayInputStream bais = ExecTemp.getInputStream(
                    tableName, DataBase.weibao);
            GeneratorTool.extracted(bais);
            System.out.println("Template processing done and output written to output.xml");
        }
    }

    private static List<String> getTable() {
        List<String> list = Arrays.asList(
                "t_claim_medicine",
                "t_claim_consultationInfo",
                "t_claim_prescription",
                "t_claim_disease"
                );
        return list;
    }


}